Getting Started#
TL;DR#
pip install waloviz
ffmpeg --version
If the
ffmpeg --versioncommand fails, try following the installation instructions in the Explanation section
import waloviz as wv
wv.extension()
wv.Audio("https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav")
Try clicking the spectrogram above, it will start playing :)
Explanation#
waloviz was built to be as accessible as possible, whether you’re using jupyter, colab, VSCode, JupyterLab or just pure HTML - you’ll only need three lines of code.
waloviz :pip install waloviz
ffmpeg is installed as a backend for torchaudio :ffmpeg --version
ffmpeg in one of the following ways:conda install -c conda-forge 'ffmpeg<7'
brew install 'ffmpeg<7'
apt-get install 'ffmpeg<7'
If none of the
ffmpeginstallation options worked for you, follow this Hostinger Tutorial, make sure to install a version lower than 7.
ffmpeg is verified to be installed properly, we move on to python!waloviz and activate the extension:import waloviz as wv
wv.extension()
import waloviz as wv
wv.extension("colab")
import waloviz as wv
wv.extension()
import waloviz as wv
wv.extension()
import waloviz as wv
# no need for the extension with pure HTML
wv.Audio with our URL or file-path:wv.Audio('https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav')
wv.Audio('https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav')
wv.Audio('https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav')
wv.Audio('https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav')
wv.save('https://www2.cs.uic.edu/~i101/SoundFiles/CantinaBand3.wav') # saves to ``waloviz.html`` by default
Using the player#
A single click on the spectrogram - toggles play\pause
Clicking on the bottom progress - moves the current time
Scrolling with the mouse wheel - zooms in\out
Dragging the mouse while pressing down - moves forwards\backwards
The small ↺ icon on the top left toolbar - resets to the initial view
Clicking on the
Download waloviz.html- downloads an HTML version of the player
What’s up with that wv.extension()?#
panel and holoviews libraries are used extensively in WaloViz.wv.extension() is actually an imitation of the pn.extension() and hv.extension() functions, and by no coincidence.wv.extension() in terms of panel and holoviews?wv.extension() contains just these two lines of code:hv.extension("bokeh")
pn.extension(comms="default")
hv.extension("plotly") just before a wv.Audio(...) call is made - WaloViz won’t work.